package beans;

import java.io.IOException;

import javax.faces.context.FacesContext;

public class BeanFunctions {

    public static void montrerPrincipalInit(MainBean mainBean)
    {
        montrerXhtml("pages/principal.xhtml", mainBean);
    }
    
    public static void montrerPrincipal(MainBean mainBean)
    {        
        montrerXhtml("principal.xhtml", mainBean);
    }
    
    public static void montrerXhtml(String xhtml, MainBean mainBean)
    {
        try
        {        
            FacesContext.getCurrentInstance().getExternalContext().redirect(xhtml);
        }
        catch(IOException e)
        {
            mainBean.setMessage(e.getMessage());
        }
    }
    
}
